package com.redisdemo.demo.redisMq;


import io.lettuce.core.RedisClient;
import io.lettuce.core.RedisURI;
import io.lettuce.core.api.StatefulRedisConnection;
import io.lettuce.core.api.sync.RedisStreamCommands;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;

@Slf4j
@Component
public class redisRunner  implements ApplicationRunner {


    @Value("${spring.redis.port}")
    private  String port;

    @Override
    public void run(ApplicationArguments args) throws Exception {
        log.info("进入redis队列初始化");
        JedisPool jedisPool;
        Jedis jedis = null;
        RedisURI redisUri = RedisURI.create("localhost", 6379);
        RedisClient redisClient = RedisClient.create(redisUri);
        StatefulRedisConnection<String, String> connection = redisClient.connect();
        RedisStreamCommands<String, String> streamCommands = connection.sync();
        System.out.println("进入初始化");
    }
}
